package com.woniuedu.search.entity;


import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * <p>
 * VIEW
 * </p>
 *
 * @author yuankaiqiang
 * @since 2022-04-20
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="Course对象", description="VIEW")
@Document(indexName = "course")
@Builder
public class Course implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @Field(name="id", type = FieldType.Keyword)
    @ApiModelProperty(value = "课程ID")
    private String id;

    @Field
    @ApiModelProperty(value = "课程讲师ID")
    @TableField("teacher_id")
    private String teacherId;

    @Field("subject_id")
    @ApiModelProperty(value = "课程专业ID")
    @TableField("subject_id")
    private String subjectId;

    @Field("subject_parent_id")
    @TableField("subject_parent_id")
    private String subjectParentId;

    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    @ApiModelProperty(value = "课程标题")
    private String title;

    @Field
    @ApiModelProperty(value = "课程销售价格，设置为0则可免费观看")
    private BigDecimal price;

    @Field("lesson_num")
    @ApiModelProperty(value = "总课时")
    @TableField("lesson_num")
    private Integer lessonNum;

    @Field
    @ApiModelProperty(value = "课程封面图片路径")
    private String cover;

    @Field("buy_count")
    @ApiModelProperty(value = "销售数量")
    @TableField("buy_count")
    private Long buyCount;

    @Field("view_count")
    @ApiModelProperty(value = "浏览数量")
    @TableField("view_count")
    private Long viewCount;

    @Field
    @ApiModelProperty(value = "乐观锁")
    private Long version;

    @Field
    @ApiModelProperty(value = "课程状态 Draft未发布  Normal已发布")
    private String status;

    @Field("is_deleted")
    @ApiModelProperty(value = "逻辑删除 1（true）已删除， 0（false）未删除")
    @TableField("is_deleted")
    private Integer isDeleted;

    @Field("gmt_create")
    @ApiModelProperty(value = "创建时间")
    @TableField("gmt_create")
    private LocalDateTime gmtCreate;

    @Field
    @ApiModelProperty(value = "更新时间")
    @TableField("gmt_modified")
    private LocalDateTime gmtModified;

    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    @ApiModelProperty(value = "课程简介")
    private String description;


}
